<template>
    <div>
    </div>
</template>
<script>
import { getMeetingTypeList } from "@/public/js/price.js";
import { getMeetingOrderList, removeMeetingOrder } from "@/service/home.js";
import { format } from "@/public/js/util.js";
export default {
  data() {
    return {
      pageSize: 10,
      pageNo: 1,
      pageNum: 1,
      total: 0,
      tableData: [],
      meetingId: 0,
      search: "",
      startTime: "",
      state: 0,
      roomTypeList: "",
      typeStr: "全部会议",
      typeStr_state: "全部状态",
      search: "",
      format: format,
      flg: false
    };
  },
  created() {
    this._getMeetingTypeList();
    this._getMeetingOrderList();
  },
  mounted() {
    //console.log(format(1547003340000,'yyyy-MM-dd hh:mm'));
  },
  methods: {
    // 会议订单列表数据
    _getMeetingOrderList() {
      var data = {
        pageSize: this.pageSize,
        pageNum: this.pageNum,
        meetingId: this.meetingId,
        search: this.search,
        startTime: this.startTime,
        state: this.state
      };
      getMeetingOrderList(data).then(res => {
        this.tableData = res.data.mOrderList;
        this.total = res.data.total;
        console.log(res.data);
      });
    },
    //获取会议下拉数据
    _getMeetingTypeList() {
      var arr = [];
      getMeetingTypeList().then(res => {
        this.roomTypeList = res.data.roomTypeList;
        arr = this.roomTypeList;
        arr.push({
          roomId: 0,
          roomName: "全部会议"
        });
        this.roomTypeList = arr;
      });
    },
    cale(list) {
      let arr = [];
      if (!list) {
        return [];
      } else {
        list.forEach(item => {
          arr.push({
            roomName: item.roomName,
            sellPrice: item.sellPrice
          });
        });
      }
      return arr;
    },
    //查询
    _reset() {
      this.pageSize = 10;
      this.pageNum = 1;
      this._getMeetingOrderList();
    },
    //详情
    See(row) {
      console.log(row);
    },
    //取消状态
    cancel(row) {
      console.log(row);
      var state;
      var data = {
        mOrderId: row.mOrderId,
        state: 6
      };
      this.$confirm("此操作将取消订单状态, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          removeMeetingOrder(data).then(res => {
            if (res.data.errCode == 0) {
              this.$message({
                type: "success",
                message: "操作成功!"
              });
              row.check = true;
              this._getMeetingOrderList();
            }
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消该操作"
          });
        });
    },
    // 会议下拉选择
    setType(e) {
      this.typeStr = e.roomName;
      this.meetingId = e.roomId;
      this._reset();
    },
    // 状态下拉选择
    setType_state(e) {
      this.typeStr_state = e.title;
      this.state = e.id;
    },
    //新增
    add() {
      // this.$router.push('/setting/meetingConfig/AddMeetingReserve')
      this.$router.push("/index/AddMeetingReserve");
    },
    handleSizeChange(value) {
      this.pageSize = value;
      this._getMeetingOrderList();
    }, // 第几页
    handleCurrentChange(value) {
      this.pageNum = value;
      this._getMeetingOrderList();
    }
  }
};
</script>
<style lang="scss" scoped>
</style>
